package com.ttg.common.enums;

import lombok.Getter;


@Getter
public enum ErrorCodeEnums {

    //----系统通用模块 0000表示成功
    SUCCESS("0", "ok"),
    SYSTEM_ERROR("9999","fail"),
    REQUEST_ILLEGAL("9001","请求非法"),
    REQUEST_AUTH_ERROR("9002","鉴权错误"),
    SIGN_ERROR("9003","签名错误"),
    DECRYPT_ERROR("9004","解密错误"),
    ENCRYPT_ERROR("9005","加密错误"),
    RESPONSE_ERROR("9006","响应错误"),
    VIP_GRADE_NAME_IS_NULL("0002","等级名称为空"),
    VIP_GRADE_IS_EXIST("0003","等级已存在"),
    VIP_GRADE_ID_IS_NULL("0004","等级Id为空"),
    VIP_GRADE_IS_NOT_EXIST("0005","等级不存在"),
    VIP_INFO_ID_IS_NULL("0005","会员Id为空"),
    VIP_GRADE_IS_NULL("0006","等级为空"),
    VIP_GRADE_CONDITION_IS_NULL("0007","条件为空"),
    VIP_GRADE_TIME_IS_NULL("0008","有效期为空"),
    VIP_CRD_ID_NO_IS_NULL("0009","身份证号为空"),
    VIP_TYPE_IS_NULL("0009","会员类型为空"),
    VIP_TYPE_IS_NOT_EXIST("0010","会员类型不存在"),
    VIP_IS_NOT_EXIST("0011","会员不存在"),
    USER_PWD_IS_WEAK("0012", "用户密码为弱密码，请修改后重新登录。"),
    APP_STATUS_ABNORMAL("A007", "应用处于非正常状态"),
    LOGIN_TOKEN_OVERDUE("A999", "登录令牌已过期或不存在"),
    TOKEN_NOT_NULL("A001", "token不能为空"),
    SIGN_NOT_NULL("A002", "签名不能为空"),
    NOT_AUTH("A003", "没有访问权限"),
    OPENID_NOT_EXIST("A004", "openid不存在"),
    OPENID_NOT_NULL("A005", "openid不能为空"),
    TOKEN_OVERDUE("A006", "令牌不存在或者已经过期"),
    VIP_QUERY_LIST_SIZE_ERROR("A008","查询条数超过1000条"),
    DATA_GET_ERROR("A009","获取数据错误"),
    REQUEST_COUPON_DATA_GET_ERROR("A010","请求权益系统获取数据错误"),
    DATA_ERROR("9901", "数据非法"),
    GXP_ERROR("9964", "请求GXP系统无响应"),

    TASK_RULES_ID_IS_NULL("0012","任务规则id为空"),
    TASK_RULES_STATUS_IS_NULL("0013","任务规则状态为空"),
    TASK_RULES_STATUS_IS_ERROR("0014","任务规则状态错误"),
    TASK_RULES_IS_NOT_EXIST("0015","任务规则不存在"),

    RULES_IS_NULL("0016","规则为空"),

    VIP_ACT_NO_IS_NULL("0017","账户号不存在"),
    VIP_MCT_NO_IS_NULL("0018","商户号不存在"),

    RULES_CONDITIONS_IS_NULL("0019","规则条件区间不能为空"),
    RULES_NUMBER_IS_MAX("0020","规则数目已达上限"),
    RULES_GROWTH_MAX_ERROR("0021","规则成长值上限为空或值小于0"),
    RULES_CONDITIONS_IS_ERROR("0022","规则条件区间值错误"),
    RULES_CONDITIONS_START_IS_ERROR("0023","规则开始条件区间值错误"),
    RULES_GROWTH_IS_ERROR("0024","规则成长值为空或值小于0"),
    GROWTH_START_IS_ERROR("0025","计算成长值错误"),
    PARAM_IS_NULL("0001","参数为空"),
    PARAM_VALIDATION_FAIL("0002","参数校验错误"),
    EXPORT_IS_ERROR("0026","导出错误"),






    BANK_INFO_IS_NULL("C0001","银行卡信息为空"),
    VIP_CARD_IS_NULL("C0002","身份证卡号为空"),
    VIP_NAME_IS_NULL("C0003","用户姓名为空"),
    VIP_MOBILE_IS_NULL("C0004","用户手机号码为空"),
    BANK_ACCOUNT_IS_NULL("C0005","银行卡号为空"),
    BANK_NAME_IS_NULL("C0006","银行卡名称为空"),
    MERCHANT_NAME_IS_NULL("C0007","商户名称为空"),
    MERCHANT_NO_IS_NULL("C0008","商户号为空"),
    BIND_BANK_CARD_ERR("C0009","绑定银行卡失败"),
    VIP_IS_ABSENT("C0010","用户不存在"),


    USER_ACCOUNT_LOCKED("U002", "您的账户已被锁定，禁止登录，请联系其它管理员协助解锁并修改新密码"),
    USER_ACCOUNT_NOT_NULL("U003", "登录帐号不能为空"),
    USER_PASSWORD_NOT_NULL("U004", "登录密码不能为空"),
    USER_NOT_EXIST("U005", "账号或密码不正确"),
    PASSWORD_ERROR("U006", "账号或密码错误！"),
    REAL_NAME_NOT_NULL("U007", "真实姓名不能为空"),
    PASSWORD_LENGTH_ERROR("U008", "密码长度有误"),
    USER_STATUS_NOT_NULL("U009", "用户状态不能为空"),
    USER_ROLE_NOT_NULL("U010", "用户角色不能为空"),
    USER_ACCOUNT_EXISTS("U011", "登录帐号已经存在，请使用其它帐号，建议使用手机号码"),
    MANAGER_NUM_NOT_NULL("U012", "管理员编号不能为空"),
    MANAGER_NOT_EXISTS("U013", "管理员不存在"),
    PASSWORD_INCONSISTENT("U014", "两次输入的密码不一致"),
    ORIGINAL_PASSWORD_ERROR("U015", "原密码错误"),
    ROLE_NAME_NOT_NULL("U016", "角色名称不能为空"),
    AUTH_NOT_NULL("U017", "权限不能为空"),
    ROLE_EXISTS("U018", "角色已经存在，请更换角色名称"),
    ROLE_NOT_EXISTS("U019", "角色不在存或无权操作"),
    ROLE_NUM_NOT_NULL("U020", "角色编号不能为空"),
    DATE_IS_ERROR("U021", "时间数据错误"),
    END_DATE_IS_ERROR("U022", "结束时间错误"),
    USER_ACCOUNT_IS_EXISTS("U023", "登录帐号已经存在，请重新启用"),
    ROLE_IS_USED("U024", "角色正在使用中"),

    TAG_NOT_EXISTS("T001","标签不存在"),
    TAG_IS_USED("T002","标签正在使用中"),
    TAG_TYPE_NOT_EXISTS("T003","标签类型不存在"),
    TAG_LIMIT("T004","标签数达上限"),
    TAG_BIND_UPDATING("T005","该标签正在更新中，请耐心等待"),

    BANK_DATA_READ_IS_ERROR("B001","银行数据读取错误"),
    BANK_CONDITIONS_CONFIG_IS_ERROR("B002","银行条件配置错误"),
    BANK_EXCEL_READ_IS_ERROR("B003","excel文件读取错误"),
    BANK_FILE_SET_VALUE_ERROR("B004","对象赋值错误"),
    BANK_FILE_PATH_NOT_EXISTS("B005","本地目录不存在且无法创建"),
    BANK_GET_FILE_PATH_ERROR("B006","获取本地目录路径错误"),
    BANK_OK_FILE_NOT_EXISTS("B007","OK文件不存在"),
    BANK_ZIP_FILE_NOT_EXISTS("B008","ZIP文件不存在"),
    BANK_DATA_NOT_EXISTS_ERROR("B009","银行数据文件不存在"),
    BANK_DATA_LENGTH_ZERO_ERROR("B010","银行数据文件大小为0"),

    //TASK
    TASK_TAG_ABSENT("TK001","任务标签不存在"),
    TASK_STOP_PRE_TASK_UNEXCUTE("TK002","前置任务未执行"),
    TASK_FOR_GROW_ALREADY_EXCUTE_TODAY("TK003","执行的成长值与积分任务当天已成功执行"),
    TASK_PRE_EXECUTED_FAIL("TK004","前置任务执行失败"),
    TASK_GROW_BACKUP_TASK_UNEXCUTE("TK005","今日未执行成长值与积分备份任务"),
    TASK_GROW_RULE_CONFIG_ERR("TKOO6","任务规则的计分配置不存在"),
    TASK_PRE_UNEXECUTED_TODAY("TK007","前置任务今日未执行"),

    //质量管理
    QM_DIM_NOT_NULL("QM001","维度类型不能为空"),
    QM_DIM_VAL_ERROR("QM002","错误的维度类型"),
    QM_DIM_LIVENESS_WEIGHT_NOT_NULL("QM003","活跃度阶梯评价权重不能为空,且不能为负值"),
    QM_DIM_CLEAR_COST_WEIGHT_NULL("QM004","清算成本阶梯评价权重不能为空,且不能为负值"),
    QM_DIM_AVG_WEIGHT_NULL("QM005","户均归集阶梯评价权重不能为空,且不能为负值"),
    QM_DIM_WEIGHT_SUM_VAL_ERROR("QM006","权重合计值必须为100%"),
    QM_LADDER_RULE_NOT_NULL("QM007","阶梯规则类型不能为空"),
    QM_LADDER_RULE_TYPE_ERROR("QM008","错误的阶梯规则类型"),
    QM_LADDER_RULE_DATA_NOT_NULL("QM009","阶梯规则列表不能为空"),
    QM_LADDER_RULE_DATA_ERROR("QM010","阶段数据不连续,请编辑后在保存!"),
    QM_TYPE_RULE_DATA_ERROR("QM012","质量分类规则一层分类数据不连续,请编辑后在保存!"),
    QM_TYPE_RULE_ERROR("QM011","错误的质量分类类型"),

    ;


    /**
     * 错误类型码
     */
    private String errcode;
    /**
     * 错误类型描述信息
     */
    private String msg;

    ErrorCodeEnums(String errcode, String msg) {
        this.errcode = errcode;
        this.msg = msg;
    }

    /**
     * 根据code值返回对应枚举CONTRACT_NOT_VERIFY_D0
     *
     * @param code
     * @return
     */
    public static ErrorCodeEnums getObjByCode(String code) {
        for (ErrorCodeEnums value : ErrorCodeEnums.values()) {
            if (value.getErrcode().equals(code)) {
                return value;
            }
        }
        return null;
    }


}
